package tiandang.core.error;

public enum EmBusinessError implements CommonError {

  // 通用错误类型
  PARAMMETER_VALIDATION_ERROR(10001, "参数不合法"),
  UNKNOW_ERROR(10002, "未知错误"),


  //20000开头为用户信息相关错误定义
  USER_NOT_EXIST(20001, "用户不存在"),
  USER_LOGIN_FAIL(20002, "用户手机号或密码错误"),
  USER_NOT_LOGIN(20003, "用户还未登录"),


  //30000开头为交易信息错误定义
  STOCK_NOT_ENOUGH(30001, "库存不足"),
  SALES_NOT_ENOUGH(30002, "销量越界"),
  ORDER_NOT_EXIST(30003, "订单不存在"),
  WXPAY_NOTIFY_MONEY_VERIFY_ERROR(30004,"订单金额不一致"),


  //40000开头为微信相关的错误定义
  FORMID_NOT_ENOUGH(40001, "没有formid记录");

  EmBusinessError(int errCode, String errMsg) {
    this.errCode = errCode;
    this.errMsg = errMsg;
  }


  private int errCode;
  private String errMsg;

  @Override
  public int getErrCode() {
    return this.errCode;
  }

  @Override
  public String getErrMsg() {
    return this.errMsg;
  }

  @Override
  public CommonError setErrMsg(String errMsg) {
    this.errMsg = errMsg;
    return this;
  }
}
